﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UwinEducation.Shared.Enums;

namespace UwinEducation.Domain.Entities
{
    /// <summary>
    ///  老师课表详情实体
    /// </summary>
    [Table("teacher_schedules_details")]
    public class TeacherScheduleDetails : EntityBase
    {
        /// <summary>
        /// ID
        /// </summary>
        public Guid Id { get; set; }

        /// <summary>
        /// 教师课表ID
        /// </summary>
        public Guid TeacherScheduleId { get; set; }

        /// <summary>
        /// 上课时间
        /// </summary>
        public DateTime StartTime { get; set; }

        /// <summary>
        /// 下课时间
        /// </summary>
        public DateTime EndTime { get; set; }

        /// <summary>
        /// 课表状态
        /// </summary>
        public ScheduleStatus Status { get; set; }

        /// <summary>
        /// 废弃原因
        /// </summary>
        public string? Reason { get; set; }

        /// <summary>
        /// 是否强校验
        /// </summary>
        public bool IsForceCheck { get; set; }
        /// <summary>
        /// 课程类型
        /// </summary>
        public CourseType CourseType { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string? Remarks { get; set; }

        /// <summary>
        /// 关联的教师课程主表
        /// </summary>
        public virtual TeacherSchedule TeacherSchedule { get; set; }

        /// <summary>
        /// 创建教师课表详情
        /// </summary>
        public static TeacherScheduleDetails Create(
            Guid teacherScheduleId,
            DateTime startTime,
            DateTime endTime,
            ScheduleStatus status,
            CourseType courseType,
            bool isForceCheck,
            string remarks)
        {
            return new TeacherScheduleDetails
            {
                Id = Guid.NewGuid(),
                TeacherScheduleId = teacherScheduleId,
                StartTime = startTime,
                EndTime = endTime,
                Status = status,
                CourseType = courseType,
                IsForceCheck = isForceCheck,
                Remarks = remarks ?? string.Empty,
                CreatedAt = DateTime.Now
            };
        }
    }
}
